package com.springboot.activemq.topic;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.stereotype.Component;

import javax.jms.Topic;
import java.util.Date;

/**
 * 主题生产者
 * @date 2020/10/8 16:05
 */
@Component
public class TopicProducer {

    @Autowired
    private JmsMessagingTemplate jmsMessagingTemplate;

    @Autowired
    private Topic topic;

    @SuppressWarnings("depercation")
    public void produceMsg(){
        jmsMessagingTemplate.convertAndSend(topic,"myTopicMessage:"+new Date().getTime());
    }

}
